package sz.szsmk.citizencard.model.network;

/**
 * 请求接口
 *
 * @author yang12345
 * @time 2017/3/20 下午5:49
 * @mail yangjunyan@xwtec.cn
 */


public class HttpJson {

    //获取短信验证码接口
    public static final String GET_SMS_CODE = "{\"channel_id\":\"000001\",\"device_id\":\"@1\",\"mobile\":\"@2\",\"type_id\":\"@3\"}";

    // 短信验证码接口
    public static final String SMS_CODE_JSON = "[{\"dynamicURI\":\"/SmsPwdLogin\",\"dynamicParameter\":{\"method\":\"sendSSOSmsCode\",\"number\":\"@1\"},\"dynamicDataNodeName\":\"sendSSOSmsCodeNode\"}]";

    //登录接口
    public static final String LOGIN_JSON = "[{\"dynamicURI\":\"/smsPwdLogin\",\"dynamicParameter\":{\"method\":\"smsAndPwdLogin\",\"m\":\"@1\",\"p\":\"@2\",\"smsCode\":\"@3\"},\"dynamicDataNodeName\":\"smsAndPwdLogin_Node\"}]";

    // 测试验证码接口

    public static final String SMS_CODE_TEST = "{\"mobile\":\"@1\",\"password\":\"@2\",\"RasUUID\":\"@3\"}";

    //测试登录接口
    public static final String LOGIN_TEST = "{\"mobile\":\"@1\",\"password\":\"@2\",\"dxYzm\":\"@3\",\"RasUUID\":\"@4\"}";

    public static final String replace(String s, String... params) {
        if (params == null || params.length == 0) {
            return s;
        }
        String result = s;
        String replaceStr = null;
        String param = null;
        for (int i = 0; i < params.length; i++) {
            param = params[i];
            replaceStr = "@" + (i + 1);
            if (result.indexOf(replaceStr) != -1) {
                result = result.replace(replaceStr, param == null ? "" : param);
            }
        }
        return result;
    }

}
